<?php
$form_token = '';
$form = $variables['form'];
$keywords = $variables['keywords'];
$enter_keyword = '输入搜索关键词';

if (user_is_logged_in()) {
  $form_token = "<input type='hidden' name='form_token' value='{$form['form_token']['#default_value']}'>";
}
?>
<?php if (arg(0) == 'search') { ?>
  <div class="mod mod-search-bar skin-web" style="display: block">
    <form action="" class="b container clearfix" method="POST">
      <input type="hidden" name="form_build_id" value="<?= $form['form_build_id']['#value'] ?>">
      <?= $form_token ?>
      <input type="hidden" name="form_id" value="<?= $form['#form_id'] ?>">
      <input autocomplete="off" type="text" class="js-query ga-input" id="keyword_input" name="keyword" placeholder="<?= $enter_keyword ?>" value="<?= $keywords ?>"
             onfocus="if(this.placeholder=='<?= $enter_keyword ?>') this.placeholder=''"
             onblur="if(this.placeholder=='') this.placeholder='<?= $enter_keyword ?>'">
      <button class="button colored icon-search">搜索</button>
    </form>
  </div>
<?php } else { ?>
  <div class="mod mod-search-bar skin-web">
    <form action="" id="searchForm" class="b container clearfix js-form-query" method="POST">
      <input type="hidden" name="form_build_id" value="<?= $form['form_build_id']['#value'] ?>">
      <?= $form_token ?>
      <input type="hidden" name="form_id" value="<?= $form['#form_id'] ?>">
      <input type="text" class="js-query ga-input" id="keyword_input" name="keyword" placeholder="<?= $enter_keyword ?>" value="<?= $keywords ?>"
             onfocus="if(this.placeholder=='<?= $enter_keyword ?>') this.placeholder=''"
             onblur="if(this.placeholder=='') this.placeholder='<?= $enter_keyword ?>'">
      <button class="button colored ga-button-primaryAction icon-search">搜索</button>
    </form>
  </div>
<?php } ?>